#custom-snippets-panel {
    background-color: @bc-panel-bg;
    position: relative;

    .dark & {
        background-color: @dark-bc-panel-bg;
    }
}

#custom-snippets-toolbar {
    background-color: @bc-panel-bg-promoted;
    border-bottom: none;
    box-shadow:
        inset 0 1px 0 @bc-highlight,
        0 -1px 3px @bc-shadow-small;

    .dark & {
        background-color: @dark-bc-panel-bg-promoted;
        border-bottom: none;
        box-shadow:
            inset 0 1px 0 @dark-bc-highlight,
            0 -1px 3px @dark-bc-shadow-small;
    }

    .title-wrapper {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .buttons {
        gap: 4px;
        flex-wrap: wrap;
        align-items: center;
    }
}

.toolbar-title {
    color: @bc-text;
    font-size: 15px;
    font-weight: 500;

    .dark & {
        color: @dark-bc-text;
    }
}

.snippets-count {
    color: @bc-text;
    font-size: 15px;
    font-weight: 500;

    .dark & {
        color: @dark-bc-text;
    }
}

.custom-snippet-btn button {
    height: 26px;
    border-radius: 4px;
    background-color: @bc-btn-bg;
    color: @bc-text;
    border: 1px solid @bc-btn-border;
    box-shadow: inset 0 1px @bc-highlight;

    .dark & {
        background-color: @dark-bc-btn-bg;
        color: @dark-bc-text;
        border: 1px solid @dark-bc-btn-border;
        box-shadow: inset 0 1px @dark-bc-highlight;
    }
}

.custom-snippet-btn button {
    display: flex;
    align-items: center;
}

.custom-snippet-btn .back-btn-left-icon {
    position: relative;
    top: 0.6px;
    margin-right: 4px;
}

.custom-snippet-btn .back-btn-text {
    position: relative;
    top: 0.6px;
}

.custom-snippet-btn .fa-plus {
    position: relative;
    top: 0.6px;
}

#custom-snippets-panel .close {
    padding-top: 2.5px;
}

#custom-snippets-panel .close:hover {
    cursor: pointer;
}

.filter-snippets-panel {
    display: inline-block;
}

.filter-snippets-panel.hidden {
    display: none;
}

.filter-snippets-panel #filter-snippets-input {
    height: 14px;
    min-width: 120px;
    margin-bottom: 0;
    margin-top: -4px;
    margin-right: 30px;
}

#custom-snippets-list.hidden {
    display: none;
}

#custom-snippets-add-new.hidden {
    display: none;
}

#custom-snippets-edit.hidden {
    display: none;
}

.custom-snippet-btn.hidden {
    display: none;
}

#no-snippets-wrapper.hidden {
    display: none;
}

#snippets-list-wrapper.hidden {
    display: none;
}

#snippets-list-header.hidden {
    display: none;
}

#custom-snippets-panel .resizable-content {
    overflow-y: auto;
    overflow-x: auto;
}

#snippets-list-wrapper {
    padding: 0 0 40px 0;
}

#snippets-list-header {
    display: block;
    padding: 4px 12px 4px 16px;
    margin: 0;
    border: none;
    background-color: #c2c7c7;
    font-size: 0;
    white-space: nowrap;
    line-height: 20px;

    .dark & {
        background-color: #202020;
    }
}

#snippet-abbr-header,
#snippet-template-header,
#snippet-description-header,
#snippet-file-extension-header {
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#snippet-abbr-header {
    width: 15%;
    min-width: 80px;
}

#snippet-template-header {
    width: 35%;
    min-width: 120px;
    padding: 0 12px;
}

#snippet-description-header {
    width: 25%;
    min-width: 100px;
    padding: 0 12px;
}

#snippet-file-extension-header {
    width: 15%;
    min-width: 60px;
    text-align: center;
}

#snippet-abbr,
#snippet-template,
#snippet-description,
#snippet-files {
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: normal;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#snippet-abbr {
    width: 15%;
    min-width: 80px;
}

#snippet-template {
    width: 35%;
    min-width: 120px;
    padding: 0 12px;
}

#snippet-description {
    width: 25%;
    min-width: 100px;
    padding: 0 12px;
}

#snippet-files {
    width: 15%;
    min-width: 60px;
    text-align: center;
}

#snippet-actions-header {
    width: 10%;
    min-width: 40px;
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
}

.snippet-item {
    display: block;
    padding: 2px 12px 2px 16px;
    margin: 0;
    border-bottom: 1px solid transparent;
    background-color: @bc-panel-bg;
    color: @bc-text;
    position: relative;
    cursor: pointer;
    transition: background-color 0.1s ease;
    font-size: 0;
    white-space: nowrap;
    line-height: 20px;

    .dark & {
        background-color: @dark-bc-panel-bg;
        color: @dark-bc-text;
    }

    &:hover {
        background-color: @bc-bg-highlight;
        color: @bc-menu-text;

        .dark & {
            background-color: @dark-bc-bg-highlight;
            color: @dark-bc-menu-text;
        }

        .delete-snippet-btn {
            opacity: 1;
        }
    }

    &:nth-child(odd) {
        background-color: @bc-panel-bg-alt;

        .dark & {
            background-color: @dark-bc-panel-bg-alt;
        }

        &:hover {
            background-color: @bc-bg-highlight;

            .dark & {
                background-color: @dark-bc-bg-highlight;
            }
        }
    }
}

#snippet-abbr-header {
    color: @bc-text;

    .dark & {
        color: @dark-bc-text;
    }
}

#snippet-abbr {
    color: @bc-text;

    .dark & {
        color: @dark-bc-text;
    }
}

#snippet-template-header {
    color: @bc-text;

    .dark & {
        color: @dark-bc-text;
    }
}

#snippet-template {
    color: @bc-text-thin;

    .dark & {
        color: @dark-bc-text-thin;
    }
}

#snippet-description-header {
    color: @bc-text;

    .dark & {
        color: @dark-bc-text;
    }
}

#snippet-description {
    color: @bc-text-thin-quiet;

    .dark & {
        color: @dark-bc-text-thin-quiet;
    }
}

#snippet-file-extension-header {
    color: @bc-text;

    .dark & {
        color: @dark-bc-text;
    }
}

#snippet-files {
    color: @bc-text-thin-quiet;

    .dark & {
        color: @dark-bc-text-thin-quiet;
    }
}

.delete-snippet-btn {
    width: 10%;
    min-width: 40px;
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box;
    color: @bc-text-thin-quiet;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.1s ease;
    text-align: center;
    font-size: 14px;
    line-height: 20px;
    padding: 0;

    .dark & {
        color: @dark-bc-text-thin-quiet;
    }

    &:hover {
        color: @bc-text;
        opacity: 1;

        .dark & {
            color: @dark-bc-text;
        }
    }

    i {
        display: inline-block;
        text-align: center;
        font-size: 12px;
        line-height: 20px;
        vertical-align: middle;
    }
}

#no-snippets-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100% - 40px);
    text-align: center;
    color: @bc-text-thin-quiet;
    padding: 20px;

    .dark & {
        color: @dark-bc-text-thin-quiet;
    }
}

#no-snippets-message {
    margin-bottom: 20px;
    color: @bc-text-thin;

    .dark & {
        color: @dark-bc-text-thin;
    }

    a {
        color: @bc-btn-border-focused;
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }

        .dark & {
            color: @dark-bc-btn-border-focused;
        }
    }
}

#add-snippet-btn button {
    background-color: @bc-btn-bg;
    border: 1px solid @bc-btn-border;
    border-radius: 3px;
    color: @bc-text;
    padding: 6px 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;

    .dark & {
        background-color: @dark-bc-btn-bg;
        border-color: @dark-bc-btn-border;
        color: @dark-bc-text;
    }

    &:hover {
        background-color: darken(@bc-btn-bg, 5%);

        .dark & {
            background-color: lighten(@dark-bc-btn-bg, 5%);
        }
    }

    &:active {
        background-color: darken(@bc-btn-bg, 10%);

        .dark & {
            background-color: lighten(@dark-bc-btn-bg, 10%);
        }
    }
}

.error-message {
    color: @bc-text-thin-quiet;
    font-size: 12px;
    font-style: italic;
    margin-left: 144px;
    padding: 0;
    background: none;
    border: none;
    animation: fadeIn 0.3s ease;

    .dark & {
        color: @dark-bc-text-thin-quiet;
    }
}

.error-input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 1px #dc3545 !important;

    .dark & {
        border-color: #ff6b6b !important;
        box-shadow: 0 0 0 1px #ff6b6b !important;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#template-text-box {
    width: 100%;
    min-height: 150px;
    max-height: 150px;
    resize: none !important;
    padding: 6px 8px;
    box-sizing: border-box;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

#custom-snippets-add-new {
    padding: 8px;
    background-color: @bc-panel-bg;
    border-top: 1px solid @bc-panel-separator;

    .dark & {
        background-color: @dark-bc-panel-bg;
        border-top: 1px solid @dark-bc-panel-separator;
    }

    .field-wrapper {
        display: flex;
        align-items: flex-start;
        margin-bottom: 8px;
        margin-left: 12px;
        margin-right: 8px;
        gap: 4px;
        flex-direction: column;

        .field-row {
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
        }

        label {
            flex: 0 0 120px;
            color: @bc-text;
            cursor: pointer;
            transition: color 0.2s ease;
            margin: 0;

            .dark & {
                color: @dark-bc-text;
            }

            &:hover {
                color: @bc-text-emphasized;

                .dark & {
                    color: @dark-bc-text-emphasized;
                }
            }
        }

        input,
        textarea {
            flex: 1;
            background-color: @bc-input-bg;
            border: 1px solid @bc-btn-border;
            color: @bc-text-thin;
            box-shadow: inset 0 1px 0 @bc-shadow-small;
            border-radius: @bc-border-radius;
            padding: 4px 8px;
            box-sizing: border-box;
            transition:
                border linear 180ms,
                box-shadow linear 180ms;

            .dark & {
                background-color: @dark-bc-input-bg;
                border: 1px solid @dark-bc-btn-border;
                color: @dark-bc-text-thin;
                box-shadow: inset 0 1px 0 @dark-bc-shadow-small;
            }

            &::-webkit-input-placeholder {
                color: @bc-text-thin-quiet;
                opacity: 0.6;

                .dark & {
                    color: @dark-bc-text-thin-quiet;
                    opacity: 0.7;
                }
            }

            &:focus {
                outline: none;
                background-color: @bc-input-bg;
                text-shadow: none;
                border: 1px solid @bc-btn-border-focused;
                box-shadow:
                    inset 0 1px 0 @bc-shadow-small,
                    0 0 0 1px @bc-btn-border-focused-glow;

                .dark & {
                    background-color: @dark-bc-input-bg;
                    border: 1px solid @dark-bc-btn-border-focused;
                    box-shadow:
                        inset 0 1px 0 @dark-bc-shadow-small,
                        0 0 0 1px @dark-bc-btn-border-focused-glow;
                }
            }

            &:disabled {
                opacity: @bc-disabled-opacity;
                cursor: default;

                .dark & {
                    opacity: @dark-bc-disabled-opacity;
                }
            }
        }

        input {
            height: 28px;
        }

        textarea {
            min-height: 80px;
            max-height: 120px;
            min-width: 156px;
            resize: none;
            line-height: 1.4;
            white-space: pre-wrap;
            overflow-wrap: break-word;
            word-break: break-word;
        }

        &:last-of-type {
            margin-bottom: 12px;
        }
    }

    #add-custom-snippet-panel-buttons {
        margin-top: 8px;
        margin-left: 12px;
        margin-right: 8px;
        padding-top: 8px;
        border-top: 1px solid @bc-panel-separator;
        text-align: right;
        display: flex;
        gap: 10px;
        justify-content: flex-end;

        .dark & {
            border-top: 1px solid @dark-bc-panel-separator;
        }

        button:disabled {
            pointer-events: none !important;

            &:hover,
            &:focus,
            &:active,
            &:visited {
                background: inherit !important;
                color: inherit !important;
                border-color: inherit !important;
                box-shadow: inherit !important;
                transform: none !important;
            }
        }
    }
}

#custom-snippets-edit {
    padding: 8px;
    background-color: @bc-panel-bg;
    border-top: 1px solid @bc-panel-separator;

    .dark & {
        background-color: @dark-bc-panel-bg;
        border-top: 1px solid @dark-bc-panel-separator;
    }

    .field-wrapper {
        display: flex;
        align-items: flex-start;
        margin-bottom: 8px;
        margin-left: 12px;
        margin-right: 8px;
        gap: 4px;
        flex-direction: column;

        .field-row {
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
        }

        label {
            flex: 0 0 120px;
            color: @bc-text;
            cursor: pointer;
            transition: color 0.2s ease;
            margin: 0;

            .dark & {
                color: @dark-bc-text;
            }

            &:hover {
                color: @bc-text-emphasized;

                .dark & {
                    color: @dark-bc-text-emphasized;
                }
            }
        }

        input,
        textarea {
            flex: 1;
            background-color: @bc-input-bg;
            border: 1px solid @bc-btn-border;
            color: @bc-text-thin;
            box-shadow: inset 0 1px 0 @bc-shadow-small;
            border-radius: @bc-border-radius;
            padding: 4px 8px;
            box-sizing: border-box;
            transition:
                border linear 180ms,
                box-shadow linear 180ms;

            .dark & {
                background-color: @dark-bc-input-bg;
                border: 1px solid @dark-bc-btn-border;
                color: @dark-bc-text-thin;
                box-shadow: inset 0 1px 0 @dark-bc-shadow-small;
            }

            &::-webkit-input-placeholder {
                color: @bc-text-thin-quiet;
                opacity: 0.6;

                .dark & {
                    color: @dark-bc-text-thin-quiet;
                    opacity: 0.7;
                }
            }

            &:focus {
                outline: none;
                background-color: @bc-input-bg;
                text-shadow: none;
                border: 1px solid @bc-btn-border-focused;
                box-shadow:
                    inset 0 1px 0 @bc-shadow-small,
                    0 0 0 1px @bc-btn-border-focused-glow;

                .dark & {
                    background-color: @dark-bc-input-bg;
                    border: 1px solid @dark-bc-btn-border-focused;
                    box-shadow:
                        inset 0 1px 0 @dark-bc-shadow-small,
                        0 0 0 1px @dark-bc-btn-border-focused-glow;
                }
            }

            &:disabled {
                opacity: @bc-disabled-opacity;
                cursor: default;

                .dark & {
                    opacity: @dark-bc-disabled-opacity;
                }
            }
        }

        input {
            height: 28px;
        }

        textarea {
            min-height: 80px;
            max-height: 120px;
            min-width: 156px;
            resize: none;
            line-height: 1.4;
            white-space: pre-wrap;
            overflow-wrap: break-word;
            word-break: break-word;
        }

        &:last-of-type {
            margin-bottom: 12px;
        }
    }

    #edit-snippet-buttons {
        margin-top: 8px;
        margin-left: 12px;
        margin-right: 8px;
        padding-top: 8px;
        border-top: 1px solid @bc-panel-separator;
        text-align: right;
        display: flex;
        gap: 10px;
        justify-content: flex-end;

        .dark & {
            border-top: 1px solid @dark-bc-panel-separator;
        }

        button:disabled {
            pointer-events: none !important;

            &:hover,
            &:focus,
            &:active,
            &:visited {
                background: inherit !important;
                color: inherit !important;
                border-color: inherit !important;
                box-shadow: inherit !important;
                transform: none !important;
            }
        }
    }
}

@media (max-width: 600px) {
    #custom-snippets-toolbar {
        .title-wrapper {
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;

            .custom-snippet-btn {
                align-self: stretch;

                button {
                    width: 100%;
                }
            }
        }

        .buttons {
            flex-direction: column;
            align-items: stretch;
            gap: 2px;
            width: 100%;

            .filter-snippets-panel,
            #close-custom-snippets-panel-btn {
                width: 100%;
                display: flex;
                justify-content: center;
            }

            .filter-snippets-panel #filter-snippets-input {
                width: 100%;
                min-width: auto;
            }
        }

        #custom-snippets-add-new,
        #custom-snippets-edit {
            .field-wrapper {
                textarea {
                    min-width: auto;
                }
            }
        }
    }

    #custom-snippets-add-new,
    #custom-snippets-edit {
        .field-wrapper {
            margin-left: 8px;
            margin-right: 4px;

            .field-row {
                flex-direction: column;
                align-items: stretch;
                gap: 4px;

                label {
                    flex: none;
                }
            }
        }

        #add-custom-snippet-panel-buttons,
        #edit-snippet-buttons {
            margin-left: 8px;
            margin-right: 4px;
        }
    }

    .error-message {
        margin-left: 8px;
    }
}

@media (max-width: 400px) {
    #custom-snippets-toolbar {
        .title-wrapper {
            margin-bottom: 4px;
        }
    }

    #custom-snippets-add-new,
    #custom-snippets-edit {
        padding: 6px;

        .field-wrapper {
            margin-bottom: 6px;
            margin-left: 6px;
            margin-right: 3px;
        }

        #add-custom-snippet-panel-buttons,
        #edit-snippet-buttons {
            margin-left: 6px;
            margin-right: 3px;
        }
    }
}
